package com.lingx.web.api.impl;

import java.util.Map;

import javax.annotation.Resource;

import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;

import com.lingx.web.api.IApi;
@Component
public class Api9014 extends AbstractDevApi implements IApi{
	@Resource
	private JdbcTemplate jdbcTemplate;
	@Override
	public int getApiCode() {
		return 9014;
	}
	@Override
	public String getApiName() {
		return "删除模型";
	}
	@Override
	public Map<String, Object> api(Map<String, Object> param) {
		Map<String,Object> ret=IApi.getRetMap(1, "操作成功");
		String code=IApi.getParamString(param, "code", "");
		/*
		if(code.indexOf("lingx")!=-1&&code.indexOf("clone")==-1){
			ret.put("code", 1);
			ret.put("message", "操作失败，不可删除平台对象");
			return ret;
		}
		*/
		jdbcTemplate.update("delete from tlingx_entity where code=?",code);
		jdbcTemplate.update("delete from tlingx_model where id=?",code);
		jdbcTemplate.update("delete from tlingx_func where module=?",code);
		jdbcTemplate.update("delete from tlingx_func where module=?",code+"_object");
		return ret;
	}

}
